import Vue from 'vue'
import VueRouter from 'vue-router'
import HomeView from '../views/HomeView.vue'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    name: 'home',
    component: HomeView,
    redirect:"/index",
    children:[
      {
        path:"/reg",
        component: () => import('../views/home/RegView.vue')
      },
      {
        path:"/login",
        component: () => import('../views/home/LoginView.vue')
      },
      {
        path:"/index",
        component: () => import('../views/home/IndexView.vue')
      },
      {
        path:"/list",
        component: () => import('../views/home/ListView.vue')
      }
      ,
      {
        path:"/detail",
        component: () => import('../views/home/DetailView.vue')
      }
      ,
      {
        path:"/personal",
        component: () => import('../views/home/PersonalView.vue'),
        children:[
          {
            path:"index",
            component:() => import('../views/home/personal/PersonalIndexView.vue')
          },
          {
            path:"management",
            component:() => import('../views/home/personal/PersonalManagementView.vue')
          }
          ,
          {
            path:"post",
            component:() => import('../views/home/personal/PersonalPostView.vue')
          }
        ]
      }
    ]
  },
  {
    path: '/admin',
    component: () => import('../views/AdminView.vue'),
    redirect: '/admin/index',
    children: [
      {
        path: "index", component: () => import('../views/admin/AdminIndexView.vue'),
      },
      {
        path: "banner", component: () => import('../views/admin/AdminBannerView.vue'),
      },
      {
        path: "content",
        component: () => import('../views/admin/AdminContentView.vue'),
      },
    ]
  }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
